home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / proofibm.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1984-11-04  |  5.8 KB  |  85 lines

  1. 1  '///////////////////////////////////////////////////////////////////////////
  2. 2  '//  This program as taken from the magazine would not function properly  //
  3. 3  '//                Modified by Jim Rector on 10-1-1984                    //
  4. 4  '///////////////////////////////////////////////////////////////////////////
  5. 10  'IBM AUTOMATIC PROOFREADER FROM: COMPUTE!'S PC & PCjr MAGAZINE                                                   VOL 1, No 7    SEPTEMBER 1984
  6. 12  'This program is designed to aid in entering programs taken from the magazine
  7. 14  'When you run the program, the screen will turn white and typing will be in      reverse video.  you may begin entering the program immeditaely.
  8. 16  'Once you have entered a line, there will be a short delay and then two          letters will appear to the left of the line number.  This is the CHECKSUM       and should correspond to that of the magazine.
  9. 18  'If they agree you have copied the line correctly; if not, recheck the line      just entered very carefully for you have made a typing error!
  10. 20  'Error may consist of extra spaces, commas instead of periods or semicolons,     etc.  PROOFREADER is very exact and will spot ANY error !!!
  11. 22  'PROOFREADER also discrimiates between upper and lower case letters because      they ARE different in it's eyes.
  12. 24  'Do not abreviate the REM as ' or PRINT as ? because these too are different     as PROOFREADER totals the binary equivalent of each keystroke.
  13. 26  '
  14. 28  '
  15. 30  'PROOFREADER COMMANDS:
  16. 32  '     -are the same as BASIC with a few exceptions
  17. 34  '     -the basic prompt is OK, PROOFREADER'S prompt is "PROOFREADER READY"
  18. 36  '     -LIST command is the same as Basic
  19. 38  '     -CHECK command is the same as list except it also displays the CHECKSUM
  20. 40  '     -LLIST command is the same as Basic
  21. 42  '     -NEW command clears the program being typed out of PROOFREADER but does          not clear PROOFREADER out of memory (a very nice feature !)
  22. 44  '     -FILES command shows a listing of programs on drive A only
  23. 46  '     -BASIC command exits the PROOFREADER and returns the Basic prompt of OK
  24. 48  '     -CONT command returns you into PROOFREADER if you have accidently given          the BASIC command.  The screen will no longer be white but PROOFREADER          and the program you were entering will still be intact !
  25. 50  '     -SAVE command is the same as in Basic and as in Basic; you are encourag          ed to use it periodically throughout the entering process.
  26. 52  '     -Unlike Basic, PROOFREADER saves the program in ASCII format.
  27. 54  '     -LOAD command is also similar to that of Basic, however the program to           be loaded MUST be in ASCII format for PROOFREADER to successfully load          it.
  28. 56  '
  29. 58  '
  30. 60  'IF YOU FIND YOU HAVE MADE AN ERROR YOU MAY CORRECT IT IMMEDIATELY AND THEN      CONTINUE ENTERING YOUR PROGRAM.  LOTS OF LUCK AND GOOD TYPING !
  31. 70  '
  32. 80  '
  33. 90  '
  34. 100  DIM L$(500),LNUM(500):COLOR 0,7,7:KEY OFF:CLS:MAX=0:LNUM(0)=65536
  35. 110  ON ERROR GOTO 120:KEY 10,CHR$(4)+CHR$(70):ON KEY(10) GOSUB 640:KEY (10) ON:GOTO 130
  36. 120  RESUME 130
  37. 130  DEF SEG=&H40:W=PEEK(&H4A)
  38. 140  ON ERROR GOTO 650:PRINT"PROOFREADER READY."
  39. 150  LINE INPUT L$:Y=CSRLIN-INT(LEN(L$)/W)-1:LOCATE Y,1
  40. 160  DEF SEG=0:POKE 1050,30:POKE 1052,34:POKE 1054,0:POKE 1055,79:POKE 1056,13:POKE 1057,28:LINE INPUT L$:DEF SEG:IF L$="" THEN 150
  41. 170  IF LEFT$(L$,1)=" " THEN L$=MID$(L$,2):GOTO 170
  42. 180  IF VAL(LEFT$(L$,2))=0 AND MID$(L$,3,1)=" " THEN L$=MID$(L$,4)
  43. 190  LNUM=VAL(L$):TEXT$=MID$(L$,LEN(STR$(LNUM))+1)
  44. 200  IF ASC(L$)>57 THEN 260  'no line number, therefore command
  45. 210  IF TEXT$="" THEN GOSUB 540:IF LNUM=LNUM(P) THEN GOSUB 560:GOTO 150 ELSE 150     'delete line
  46. 220  CKSUM=0:FOR I=1 TO LEN(L$):CKSUM=(CKSUM+ASC(MID$(L$,I))*I) AND 255:NEXT:LOCATE Y,1:PRINT CHR$(65+CKSUM/16)+CHR$(65+(CKSUM AND 15))+" "+L$
  47. 230  GOSUB 540:IF LNUM(P)=LNUM THEN L$(P)=TEXT$:GOTO 150  'replace line
  48. 240  GOSUB 580:GOTO 150  'insert the line
  49. 250  'command processor.  step 1: convert to upper case
  50. 260  TEXT$="":FOR I=1 TO LEN(L$):A=ASC(MID$(L$,I)):TEXT$=TEXT$+CHR$(A+32*(A>96 AND A<123)):NEXT
  51. 270  DELIMITER=INSTR(TEXT$," "):COMMAND$=TEXT$:ARG$="":IF DELIMITER THEN COMMAND$=LEFT$(TEXT$,DELIMITER-1):ARG$=MID$(TEXT$,DELIMITER+1):GOTO 280  'separate command from an argument if delimiter is a space
  52. 275  DELIMITER=INSTR(TEXT$,CHR$(34)):COMMAND$=TEXT$:ARG$="":IF DELIMITER THEN COMMAND$=LEFT$(TEXT$,DELIMITER-1):ARG$=MID$(TEXT$,DELIMITER)  'separate command from an argument if delimiter is a quote mark
  53. 280  IF COMMAND$<>"LIST" THEN 410
  54. 290  OPEN "scrn:" FOR OUTPUT AS #1
  55. 300  IF ARG$="" THEN FIRST=0:P=MAX-1:GOTO 340
  56. 310  DELIMITER=INSTR(ARG$,"-"):IF DELIMITER=0 THEN LNUM=VAL(ARG$):GOSUB 540:FIRST=P:GOTO 340
  57. 320  FIRST=VAL(LEFT$(ARG$,DELIMITER)):LAST=VAL(MID$(ARG$,DELIMITER+1))
  58. 330  LNUM=FIRST:GOSUB 540:FIRST=P:LNUM=LAST:GOSUB 540:IF P=0 THEN P=MAX-1
  59. 340  FOR X=FIRST TO P:N$=MID$(STR$(LNUM(X)),2)+" "
  60. 350  IF CKFLAG=0 THEN A$="":GOTO 370
  61. 360  CKSUM=0:A$=N$+L$(X):FOR I=1 TO LEN(A$):CKSUM=(CKSUM+ASC(MID$(A$,I))*I) AND 255:NEXT I:A$=CHR$(65+CKSUM/16)+CHR$(65+(CKSUM AND 15))+" "
  62. 370  PRINT #1,A$+N$+L$(X)
  63. 380  IF INKEY$<>"" THEN X=P
  64. 390  NEXT X:CLOSE #1:CKFLAG=0
  65. 400  GOTO 130
  66. 410  IF COMMAND$="LLIST" THEN OPEN "lpt1:" FOR OUTPUT AS #1:GOTO 300
  67. 420  IF COMMAND$="CHECK" THEN CKFLAG=1:GOTO 290
  68. 425  PRINT COMMAND$
  69. 430  IF COMMAND$<>"SAVE" THEN 450
  70. 440  GOSUB 600:OPEN ARG$ FOR OUTPUT AS #1:ARG$="":GOTO 300
  71. 450  IF COMMAND$<>"LOAD" THEN 490
  72. 460  GOSUB 600:OPEN ARG$ FOR INPUT AS #1:MAX=0:P=0
  73. 470  WHILE NOT EOF(1):LINE INPUT #1,L$:LNUM(P)=VAL(L$):L$(P)=MID$(L$,LEN(STR$(VAL(L$)))+1):P=P+1:WEND
  74. 480  MAX=P:CLOSE #1:GOTO 130
  75. 490  IF COMMAND$="NEW" THEN INPUT "ERASE PROGRAM - ARE YOU SURE ?";L$:IF LEFT$(L$,1)="Y" OR LEFT$(L$,1)="y" THEN MAX=0:GOTO 130:ELSE 130
  76. 500  IF COMMAND$="BASIC" THEN COLOR 7,0,0:ON ERROR GOTO 0:CLS:END
  77. 510  IF COMMAND$="FILES" THEN FILES:GOTO 130
  78. 520  PRINT"SYNTAX ERROR":GOTO 130
  79. 530  'find line
  80. 540  P=0:WHILE LNUM>LNUM(P) AND P<MAX:P=P+1:WEND:RETURN
  81. 550  'delete line
  82. 560  MAX=MAX-1:FOR X=P TO MAX:LNUM(X)=LNUM(X+1):L$(X)=L$(X+1):NEXT:RETURN
  83. 570  'insert line
  84. 580  MAX=MAX+1:FOR X=MAX TO P+1 STEP-1:LN4 12:49   ALIGN   .BAS    822   A 04/24/84 23:21<UNK! {000D}><UNK! {000A}>CRYPT   .DOC   1664   A 02/03/84 23:27   FLASHDNC.BAS   1442   A 04/24/84 23:27<UNK! {000D}><UNK! {000A}>GL      .LBR 105984   A 12/02/84 18:01   COMPRS  .COM    128   A 04/07/84 22:04<UNK! {000D}><UNK! {000A}>COLUMNS .DOC   1152   A 02/03/84 23:40   NOPRTYCK.COM    384   A 04/07/8
  85.